home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 41 / Amiga Format CD41 (1999-06)(Future Publishing)(GB)[!][issue 1999-07].iso / -screenplay- / otherstuff / jst_dev / installwizard / copy_of_installwizard < prev    next >
Text File  |  1999-04-20  |  16KB  |  568 lines

  1. ; setup
  2.  
  3. (set #iwversion "1.1")
  4. (set #year "1999")    ; not certified for year 2000, update needed :)
  5. (set #sourcedir "source")
  6. (set #iconsdir "icons")
  7. (set #bindir "binary")
  8. (set #readmedir "readme")
  9. (set #inspartsdir "installer-parts")
  10.  
  11. ; work variables
  12.  
  13. (set #sedcommand "binary/sed")
  14. (set #sedfile "T:sedfile")
  15.  
  16. ; get environment variables
  17.  
  18. (set #authorname (getenv "INSW/AUTHORNAME"))
  19. (set #authoremail (getenv "INSW/AUTHOREMAIL"))
  20. (set #editor (getenv "INSW/EDITOR"))
  21. (set #installroot (getenv "INSW/INSTALLROOT"))
  22. (set #loaderdevroot (getenv "INSW/LOADERDEVROOT"))
  23.  
  24. ; check for authorname, compulsory
  25.  
  26. (if (= #authorname "")
  27.     (abort "The environment variable AUTHORNAME is empty!")
  28. )
  29.  
  30. (if (= #authoremail "")
  31.     (set #authoremail "no email")
  32. )
  33.  
  34. (set #srcsubdir "")
  35. (set #subdir "")
  36. (set #indextype 0)
  37.  
  38. ; user prompts
  39.  
  40. (set #gamename
  41.     (askstring (prompt "What's the name of the game/demo you want\nto create an install for ?")
  42.     (help "This name will be used to set the game name, not the game directory\n"
  43.           "so you can include spaces in it")
  44.     (default "")
  45.     )
  46. )
  47.  
  48. (set #srctype
  49.      (askchoice (prompt ("What kind of media %s is originally stored on?" #gamename ))
  50.                 (help "The install procedure will be different depending on the\n"
  51.                       "source (files/diskfiles, etc...)")
  52.                 (choices
  53.                   "Standard files (CD-ROM)"
  54.                   "Standard files (floppies)"
  55.                   "Standard diskfiles (disk2file, DIC)"
  56.                   "Non standard disk files (custom disk ripper)"
  57.                   "Non standard files (custom file ripper)"
  58.                 )
  59.              1
  60.       )
  61. )
  62.  
  63. (set #nbdisks 1)
  64.  
  65. (if (NOT (= 0 #srctype))
  66. (
  67.   (set #nbdisks
  68.     (asknumber (prompt "How many disks does the game come with")
  69.                (help "This number will be used in the install-script"
  70.                      "and maybe in the loader")
  71.                (range 1 10)
  72.     )
  73.  
  74.   )
  75.  
  76.   (set #indextype
  77.      (askchoice (prompt "What's the first disk index?")
  78.                 (help "If the disks do not have a incremental disk index\n"
  79.                       "then you'll do it by hand later!")
  80.                 (choices
  81.                   "1"
  82.                   "A"
  83.                   "a"
  84.                 )
  85.              0
  86.       )
  87.   )
  88.  
  89.   (if (= 0 #indextype)
  90.     (set #indexascii 49)
  91.   )
  92.  
  93.   (if (= 1 #indextype)
  94.     (set #indexascii 65)
  95.   )
  96.  
  97.   (if (= 2 #indextype)
  98.     (set #indexascii 97)
  99.   )
  100.  
  101.  
  102.   (message ("first %lc" #indexascii))
  103. )
  104.  
  105.  
  106. )
  107.  
  108. (set #gamedir
  109.     (askstring (prompt "What should the drawer name be called ?\n\n"
  110.                    "(don't put the HD suffix)?")
  111.                (help "The user and developper install drawer names\n"
  112.                      "will be computed accordingly")
  113.                (default "")
  114.     )
  115. )
  116.  
  117. (set #osemu
  118.      (askbool (prompt "Will the loader use OS emulation module ?")
  119.                 (help "OS emulation module was written by Harry\n"
  120.                       "and allows to run many games by emulating the Amiga OS\n"
  121.                       "which ensures OS-independance, WB startup, clean quit...")
  122.                 (choices
  123.                   "Yes"
  124.                   "No"
  125.                 )
  126.                 (default 1)
  127.       )
  128. )
  129.  
  130. (set #osblast 1)
  131.  
  132. ; if osemu is active, the OS won't be active, else, ask
  133.  
  134. (if (= 0 #osemu)
  135. (set #osblast
  136.      (askbool (prompt "Does the launching process overtakes the system ?")
  137.                 (help "If you write a JST loader, it will overtake the system\n"
  138.                       "but if you use JST as a degrader only, then it won't")
  139.                 (choices
  140.                   "Yes"
  141.                   "No"
  142.                 )
  143.                 (default 1)
  144.       )
  145. )
  146. )
  147.  
  148. ; if OS is to be disabled, ask chipmem size
  149.  
  150. (set #chipsize 0)
  151. (set #extsize 0)
  152.  
  153. (if (= 1 #osblast)
  154. (
  155. (set #chipsize
  156.      (askchoice (prompt "Which amount of chip memory will the game use")
  157.                 (help "If it's an old ECS game, it will probably use only 512K\n"
  158.                       "If it's AGA, it often demands 1 or 2megs\n\n"
  159.                       "If you need to specify another size, do it manually\n"
  160.                       "in the asm source")
  161.                 (choices
  162.                   "512K ($80000 bytes)"
  163.                   "1024K ($100000 bytes)"
  164.                   "1536K ($180000 bytes)"
  165.                   "2048K ($200000 bytes)"
  166.                 )
  167.              1
  168.       )
  169. )
  170. (set #extsize
  171.      (askchoice (prompt "Which amount of expansion memory will the game use")
  172.                 (help "If it's an old ECS game, it will probably use only 512K\n"
  173.                       "If it's AGA, it often demands 1 or 2megs\n\n"
  174.                       "If you need to specify another size, do it manually\n"
  175.                       "in the asm source")
  176.                 (choices
  177.                   "none"
  178.                   "512K ($80000 bytes)"
  179.                   "1024K ($100000 bytes)"
  180.                 )
  181.              1
  182.       )
  183. )
  184.  
  185. (set #chipsize (* (+ #chipsize 1) $80000))
  186. (set #extsize (* #extsize $80000))
  187.  
  188. (set #noaga
  189.      (askbool (prompt "Is the game AGA or ECS ?")
  190.                 (help "If you specify AGA, the loader will display\nan error on a ECS computer")
  191.                 (choices
  192.                   "ECS"
  193.                   "AGA"
  194.                 )
  195.                 (default 1)
  196.       )
  197. )
  198.  
  199. (if (AND (= 0 #noaga) (NOT (= $200000 #chipsize)))
  200.   (message "Warning!\nyou selected AGA\n"
  201.            "with a chipmem size different of 2Megs")
  202. )
  203.  
  204. (if (OR (= 2 #srctype) (= 3 #srctype))
  205.   (set #diskfile
  206.     (askstring (prompt "What should be the prefix of the diskfiles ?")
  207.                (help "This string will be used in the install-script"
  208.                      "and in the loader")
  209.                (default ("%s.d" #gamedir))
  210.     )
  211.  
  212.   )
  213. )
  214.  
  215. (set #fromfiles 0)
  216.  
  217. (if (OR (= 4 #srctype) (= 3 #srctype) (= 1 #srctype) (= 0 #srctype))
  218.  (
  219.   (set #fromfiles 1)
  220.   (set #subdir
  221.     (askstring (prompt "If you want to store the files in a subdir\n"
  222.                        "enter the subdir name here")
  223.                (help "Leave empty if you don't want a subdir")
  224.                (default "")
  225.     )
  226.  
  227.   )
  228.  
  229.   (set #sizelimit
  230.     (asknumber (prompt "What's the max size file limit for HDLOAD")
  231.                (help "This number will be used in the loader for\n"
  232.                      "the argument of LoadSmallFiles()")
  233.                (range 100 500000)
  234.                (default 10000)
  235.     )
  236.   )
  237.  )
  238.  
  239. )
  240.  
  241.  
  242. ); end osblast
  243.  
  244. ); end non-osblast 
  245.  
  246. (set #readmefile
  247.    (askstring (prompt "What should be the name of the readme ?")
  248.               (help "Name of the readme file, should be the same as user install dir")
  249.               (default ("%shd.readme" #gamedir))
  250.     )
  251. )
  252.  
  253.  
  254. (if (OR (= 0 #srctype) (AND (= 1 #srctype) (= 1 #nbdisks) ) )
  255. (
  256. (set #noindex 1)
  257. (set #disklabel
  258.    (askstring (prompt "What's the label of the disk/CDROM\n")
  259.               (help "The label is also the volume name")
  260.               (default #gamedir)
  261.     )
  262. )
  263. (set #srcsubdir
  264.   (askstring (prompt "If the base directory is not the root of the volume,\n"
  265.                      "enter the subdir name here, else leave empty")
  266.              (help "Leave empty if the source is the root directory")
  267.              (default "")
  268.   )
  269.  
  270. )
  271.  
  272. )
  273. )
  274.  
  275. (if (AND (= 1 #srctype) (> #nbdisks 1) )
  276. (
  277. (set #noindex 0)
  278. (set #disklabel
  279.    (askstring (prompt "What's the label prefix of the disks\n"
  280.                       "(without the number if there are more than one disk) ?")
  281.               (help "If the game has more than one disk,\n"
  282.                     "the program assumes that the disks are labelled\n"
  283.                     "like this <disklabel>1, <disklabel>2, etc...")
  284.               (default #gamedir)
  285.     )
  286. )
  287. )
  288. )
  289.  
  290.  
  291. (set #installdir (tackon #installroot ("%sHD" #gamedir)) )
  292. (set #loaderdevdir (tackon #loaderdevroot ("%sHDDev" #gamedir)) )
  293.  
  294. (makedir #installdir (infos) )
  295. (makedir #loaderdevdir (infos) )
  296.  
  297. ; only on installs with 1 disk, or else could be too strict
  298.  
  299. (if (AND (= 2 #srctype) (= 1 #nbdisks))
  300.   (set #srarg
  301.      (askbool (prompt "Is the disk protected by Rob Northern Copylock (track 0 head 1)")
  302.                 (help "If you're not sure of this, answer no, you'll add SKIPROB\n"
  303.                       "by hand in the generated install if disk2file reports an error")
  304.                 (choices
  305.                   "No"
  306.                   "Yes"
  307.                 )
  308.                 (default 1)
  309.       )
  310.   )
  311. )
  312.  
  313. ; working...
  314.  
  315. (working)
  316.  
  317. (if (= 1 #srarg)
  318.    (set #skiprob "SKIPROB")
  319. )
  320.  
  321. ; loader name
  322.  
  323. (set #loaderfile ("%sHD" #gamedir))
  324.  
  325. ; build the sed command file
  326.  
  327. (textfile (dest #sedfile) (append ("s#%%gamename%%#%s#g\n" #gamename)) )
  328. (textfile (dest #sedfile) (include #sedfile) (append ("s#%%authorname%%#%s#g\n" #authorname)) )
  329. (textfile (dest #sedfile) (include #sedfile) (append ("s#%%authoremail%%#%s#g\n" #authoremail)) )
  330. (textfile (dest #sedfile) (include #sedfile) (append ("s#%%authorname%%#%s#g\n" #authorname)) )
  331. (textfile (dest #sedfile) (include #sedfile) (append ("s#%%year%%#%s#g\n" #year)) )
  332. (textfile (dest #sedfile) (include #sedfile) (append ("s#%%diskfile%%#%s#g\n" #diskfile)) )
  333. (textfile (dest #sedfile) (include #sedfile) (append ("s#%%nbdisks%%#%ld#g\n" #nbdisks)) )
  334. (textfile (dest #sedfile) (include #sedfile) (append ("s#%%skiprob%%#%s#g\n" #skiprob)) )
  335. (textfile (dest #sedfile) (include #sedfile) (append ("s#%%readmefile%%#%s#g\n" #readmefile)) )
  336. (textfile (dest #sedfile) (include #sedfile) (append ("s#%%loaderfile%%#%s#g\n" #loaderfile)) )
  337. (textfile (dest #sedfile) (include #sedfile) (append ("s#%%gamedir%%#%s#g\n" #gamedir)) )
  338. (textfile (dest #sedfile) (include #sedfile) (append ("s#%%disklabel%%#%s#g\n" #disklabel)) )
  339. (textfile (dest #sedfile) (include #sedfile) (append ("s#%%extsize%%#$%lx#g\n" #extsize)) )
  340. (textfile (dest #sedfile) (include #sedfile) (append ("s#%%chipsize%%#$%lx#g\n" #chipsize)) )
  341. (textfile (dest #sedfile) (include #sedfile) (append ("s#%%sizelimit%%#%ld#g\n" #sizelimit)) )
  342. (textfile (dest #sedfile) (include #sedfile) (append ("s#%%subdir%%#%s#g\n" #subdir)) )
  343. (textfile (dest #sedfile) (include #sedfile) (append ("s#%%srcsubdir%%#%s#g\n" #srcsubdir)) )
  344. (if (= 2 #srctype)
  345.   (textfile (dest #sedfile) (include #sedfile) (append "s#%disksize%#STD_DISK_SIZE#g\n") )
  346. )
  347.  
  348. (if (= 1 #osblast)
  349. (
  350.  
  351. (if (= #fromfiles 1)
  352.   (textfile (dest #sedfile) (include #sedfile) (append "s#.*!diskload.*##\n") )  ; then
  353.   (textfile (dest #sedfile) (include #sedfile) (append "s#.*!fileload.*##\n") )  ; else
  354. )
  355.  
  356. (if (= 0 #osemu)
  357.   (textfile (dest #sedfile) (include #sedfile) (append "s#.*!osemu.*##\n") )
  358. )
  359.  
  360. (if (= 1 #noaga)
  361.   (textfile (dest #sedfile) (include #sedfile) (append "s#.*!aga.*##\n") )
  362. )
  363.  
  364. (if (= 0 #extsize)
  365.   (textfile (dest #sedfile) (include #sedfile) (append "s#.*!expmem.*##\n") )
  366. )
  367.  
  368. (if (= "" #subdir)
  369.   (textfile (dest #sedfile) (include #sedfile) (append "s#.*!subdir.*##\n") )
  370. )
  371.  
  372. ; anyway remove all ! comments
  373.  
  374. (textfile (dest #sedfile) (include #sedfile) (append "s#[     ]*; ![a-z].*##\n") )
  375.  
  376. ; copy the binary loader template
  377.  
  378. (copyfiles (source (tackon #bindir "TestHD")) (dest #loaderdevdir) (newname #loaderfile))
  379. (copyfiles (source (tackon #iconsdir "TestHD.info")) (dest #loaderdevdir) (newname ("%s.info" #loaderfile)) )
  380. (copyfiles (source (tackon #bindir "TestHD")) (dest #installdir) (newname #loaderfile))
  381. (copyfiles (source (tackon #iconsdir "TestHD.info")) (dest #installdir) (newname ("%s.info" #loaderfile)) )
  382.  
  383.  copy the Build file+icon
  384.  
  385. (copyfiles (source (tackon #sourcedir "Build")) (dest #loaderdevdir))
  386. (copyfiles (source (tackon #iconsdir "Build.info")) (dest #loaderdevdir))
  387.  
  388. ; generate the Makefile source
  389.  
  390. (run ("%s -f %s %s > %s" 
  391.        #sedcommand
  392.        #sedfile
  393.       (tackon #sourcedir "Makefile")
  394.       (tackon #loaderdevdir "Makefile") )
  395. )
  396.  
  397. (set #srcname ("%s.asm" #loaderfile) )
  398.  
  399. ; copy the Makefile and source icon
  400.  
  401. (copyfiles (source (tackon #iconsdir "Makefile.info")) (dest #loaderdevdir) )
  402. (copyfiles (source (tackon #iconsdir "hd.asm.info")) (dest #loaderdevdir) (newname ("%s.info" #srcname)) )
  403.  
  404. ; sets default tool $EDITOR for both asm file and Makefile
  405.  
  406. (tooltype (dest (tackon #loaderdevdir "Makefile")) (setdefaulttool #editor))
  407. (tooltype (dest (tackon #loaderdevdir #srcname)) (setdefaulttool #editor))
  408.  
  409. ; generate the asm source file template
  410.  
  411. (run ("%s -f %s %s > %s" 
  412.        #sedcommand
  413.        #sedfile
  414.       (tackon #sourcedir "hd.asm")
  415.       (tackon #loaderdevdir #srcname) )
  416. )
  417.  
  418. ; add loadseg utility subroutine
  419.  
  420. (if (= 1 #osemu)
  421.   (textfile (dest (tackon #loaderdevdir #srcname) )
  422.             (include (tackon #loaderdevdir #srcname) )
  423.             (include (tackon #sourcedir "loadseg.asm") )
  424.   )
  425. )
  426.  
  427. ) ; end of osblast
  428.  
  429. ; OS is used, create an empty script
  430.  
  431. (
  432. (copyfiles (source (tackon #iconsdir "RunGame.info") ) (dest #installdir) (newname "RunGame.icon") )
  433. (textfile (dest (tackon #installdir "RunGame")) (append (";; JST %s EXECUTE") #gamedir) )
  434. )
  435.  
  436. ) ; end of not osblast
  437.  
  438. ; generate the specific readme
  439.  
  440. (run ("%s -f %s %s > %s" 
  441.        #sedcommand
  442.        #sedfile
  443.       (tackon #readmedir "gamehd.readme")
  444.       (tackon #installdir #readmefile) )
  445. )
  446.  
  447. ; processes the icons
  448.  
  449. (copyfiles (source (tackon #iconsdir "gamehd.readme.info") )
  450.            (dest #installdir)
  451.            (newname ("%s.info" #readmefile) )
  452. )
  453.  
  454. (set #installiconname ("Install-%s.info" #gamedir) )
  455.  
  456. (copyfiles (source (tackon #iconsdir "Install-game.info"))
  457.            (dest #installdir)
  458.            (newname #installiconname)
  459. )
  460.  
  461. ; generates the install script
  462.  
  463. (set #installdest ("Install-%s" #gamedir) )
  464. (set #tmpinstall (tackon "T:" #installdest) )
  465.  
  466. (set #installicon (tackon #installdir #installiconname) )
  467. (set #finalicon (tackon #installdir #installdest) )
  468.  
  469. ; sets the tooltypes
  470.  
  471. (tooltype (dest #finalicon) (settooltype "APPNAME" #gamename) )
  472. (tooltype (dest #finalicon) (settooltype "MINUSER" "expert") )
  473.  
  474. (if (> #srctype 1)
  475.   (tooltype (dest #finalicon) (settooltype "PRETEND" "FALSE") )
  476. )
  477.  
  478. ; appends files to main file
  479.  
  480. (textfile (dest #tmpinstall) (include (tackon #inspartsdir "Install-init")) )
  481.  
  482. (if (= 1 #osemu)
  483. (
  484. (textfile (dest #tmpinstall) (include #tmpinstall) (include (tackon #inspartsdir "Copy-osemu")) )
  485. (copyfiles (source (tackon #bindir "OSEmu.400")) (dest #installdir))
  486. )
  487. )
  488. (if (= 1 #osblast)
  489. (textfile (dest #tmpinstall) (include #tmpinstall) (include (tackon #inspartsdir "Copy-loader")) )
  490. )
  491.  
  492. (if (> #srctype 1)
  493. (textfile (dest #tmpinstall) (include #tmpinstall) (include (tackon #inspartsdir "Choose-drive")) )
  494. )
  495.  
  496. (if (NOT (= "" #subdir))
  497.   (textfile (dest #tmpinstall) (include #tmpinstall) (append ("\n(set #subdir \"%s\")\n\n" #subdir)) )
  498. )
  499.  
  500. ;; loop to make disk images/copy files
  501.  
  502. (if (> #srctype 0)
  503. (
  504. (set #diskno 1)
  505. (while
  506.   (<= #diskno #nbdisks)
  507.   (
  508.  
  509.     (if (= 2 #srctype)
  510.      (textfile (dest #tmpinstall) (include #tmpinstall) (include (tackon #inspartsdir "Make-diskimage")) )
  511.     )
  512.  
  513.      (if (= 1 #srctype)
  514.       (
  515.        (if (= #noindex 0)
  516.          (textfile (dest #tmpinstall) (include #tmpinstall) (append "(set #currentdisk (\"%disklabel%%ld\" #diskno))\n") )
  517.          (textfile (dest #tmpinstall) (include #tmpinstall) (append "(set #currentdisk \"%disklabel%\")\n") )
  518.        )
  519.          (textfile (dest #tmpinstall) (include #tmpinstall) (include (tackon #inspartsdir "Copy-floppy")) )
  520.        )
  521.      )
  522.  
  523.      (if (> #srctype 2)
  524.         (textfile (dest #tmpinstall) (include #tmpinstall) (append "(run \"any ripper command\")\n") )
  525.      )
  526.    (textfile (dest #tmpinstall) (include #tmpinstall) (append "(set #diskno (+ #diskno 1))\n") )
  527.    )
  528.  
  529.    (set #diskno (+ #diskno 1))
  530.   )
  531.  
  532. )
  533. ;; CD-ROM source (srctype = 0)
  534. (textfile (dest #tmpinstall) (include #tmpinstall) (include (tackon #inspartsdir "Copy-cdrom")) )
  535. )
  536.  
  537. (if (= #osblast 0)
  538. (textfile (dest #tmpinstall) (include #tmpinstall) (include (tackon #inspartsdir "Copy-startup")) )
  539. )
  540.  
  541. ; generate the specific install-script
  542.  
  543. (run ("%s -f %s %s > %s" 
  544.        #sedcommand
  545.        #sedfile
  546.        #tmpinstall
  547.        #finalicon)
  548. )
  549.  
  550. ; cleanup
  551.  
  552. (delete #tmpinstall)
  553. (delete #sedfile)
  554.  
  555. ; optionnal readme edition
  556.  
  557. (if (= 1 
  558. (askbool (prompt "Do you want to edit the readme file now?")
  559.    (help "You'll be able to edit it later anyway")
  560.    (choices "Yes" "No")
  561.    (default 0)
  562. )
  563. )
  564. (run ("%s %s" #editor (tackon #installdir #readmefile) ))
  565. )
  566.  
  567. ; install-script generated
  568.